package com.gdlt.mq2db;

import org.apache.hadoop.conf.Configuration;

/**
 * Created by CM on 2017/3/14.
 *
 */

public class Kafka2pgConfig {
    // 1. Configuration 对象是可以直接实例化的
    static Configuration conf = new Configuration(false);
    public static String TOPIC_CONF_NAME = "kafka2pg.kafka.topic";
    public static String TOPIC_DEFAULT_VALUE = "golia";

    public static String SERVERS_CONF_NAME = "kafka2pg.kafka.bootstrap.servers";
    public static String SERVERS_DEFAULT_VALUE = "";

    public static String GROUP_ID_CONF_NAME = "kafka2pg.kafka.group.id";
    public static String GROUP_ID_DEFAULT_VALUE = "";

    public static String BATCHSIZE_CONF_NAME = "kafka2pg.kafka.batchsize";
    public static String TIMEOUT_CONF_NAME = "kafka2pg.kafka.timeout";

    public static String KEY_DESER_CONF_NAME = "kafka2pg.kafka.key.deserializer";
    public static String VALUE_DESER_CONF_NAME = "kafka2pg.kafka.value.deserializer";

    public static String PG_URL_CONF_NAME = "kafka2pg.pg.url";
    public static String PG_USER_CONF_NAME = "kafka2pg.pg.user";
    public static String PG_PASSWORD_CONF_NAME = "kafka2pg.pg.password";
    public static String PG_DRIVER_CONF_NAME = "kafka2pg.pg.driver";


    public static void AddConfig(String confFile) {
        // 2. 通过调用 addResource 方法来将配置资源注册到 Configuration
        // 对象中，这个时候 Configuration 对象内还没有加载配置中的内容
        if (confFile != null) {
            conf.addResource(confFile);
        }
    }

    public static Configuration getConf() {
        return conf;
    }

}
